# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=sublist3r
pkgver=138.729d649
pkgrel=8
arch=('any')
groups=('blackarch' 'blackarch-recon' 'blackarch-scanner')
pkgdesc='A Fast subdomains enumeration tool for penetration testers.'
url='https://github.com/aboul3la/Sublist3r'
license=('GPL2')
depends=('python' 'python-dnspython' 'python-requests')
makedepends=('git')
source=("$pkgname::git+https://github.com/aboul3la/Sublist3r.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  rm README.md LICENSE

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

